<template>
  <Module :cfg="moduleCfg">
    <VBarChart :data="getChartData" :cfg="vBarChartCfg"></VBarChart>
  </Module>
</template>

<script>
import Module from 'comp/common/Module';
import VBarChart from 'kkui/echarts/VBarChart';

export default {
  name: "CenterEvtCount",
  components: {
    Module,
    VBarChart
  },
  props: ['data'],
  data() {
    return {
      moduleCfg: {
        icon: WebCfg.icons.centerEvtCount,
        title: `各中心事件`
      },
      vBarChartCfg:{
        barWidth: 30
      }
    }
  },
  computed:{
    getChartData(){
      const newData = {name: [], value: []};
      this.data.forEach(item => {
        newData.name.push(item['centerUnder']);
        newData.value.push(item['eventCount']);
      });
      return newData;
    }
  },
  methods: {

  }
}
</script>

<style scoped>

</style>
